#include "junix.h"

int main(int argc, char **argv)
{
    int fd = passive_tcp("ftp",5);
    struct sockaddr sock;
    socklen_t len=sizeof(sock);
    
    if ( getsockname(fd, &sock, &len) < 0 )
        err_sys("getsockname");

	char host[1024];
	char service[1024];

	if ( getnameinfo( &sock, len, host, sizeof(host), service, sizeof(service), 0) )
		err_sys("getnameinfo");

	printf("host:%s\n", host);
	printf("service:%s\n",service);
     
    exit(0);
}

